package com.bugsnag.ohos;

import com.bugsnag.ohos.internal.ImmutableConfig;

/**
 * ClientObservable
 *
 * @since 2021-07-02
 */
public class ClientObservable extends BaseObservable {
    /**
     * postOrientationChange
     *
     * @param orientation
     */
    public void postOrientationChange(String orientation) {
        updateState(new StateEvent.UpdateOrientation(orientation));
    }

    /**
     * postMemoryTrimEvent
     *
     * @param isLowMemory
     */
    public void postMemoryTrimEvent(Boolean isLowMemory) {
        updateState(new StateEvent.UpdateMemoryTrimEvent(isLowMemory));
    }

    /**
     * postNdkInstall
     *
     * @param conf
     * @param lastRunInfoPath
     * @param consecutiveLaunchCrashes
     */
    public void postNdkInstall(
        ImmutableConfig conf,
        String lastRunInfoPath,
        int consecutiveLaunchCrashes) {
        updateState(new StateEvent.Install(
            conf.getApiKey(),
            conf.getEnabledErrorTypes().ndkCrashes,
            conf.getAppVersion(),
            conf.getBuildUuid(),
            conf.getReleaseStage(),
            lastRunInfoPath,
            consecutiveLaunchCrashes
        ));
    }

    /**
     * postNdkDeliverPending
     */
    public void postNdkDeliverPending() {
        updateState(new StateEvent.DeliverPending());
    }
}
